XV-11 API Commands
Commands available through the USB port on the XV-11
Neato Robotics currently has an list of commands accessible to people who want to tinker with their robots.
See their official site for information:
http://www.neatorobotics.com/programmers-manual
Getting a list of Commands
Your first point of call is the Neato Robotics Programmers Manual listed above. Also if you have an established link to your Neato you can type:-
help
which will list all available commands.
You can also get additional information about commands by typing the command function name after the word help, eg:-
help getmotors
Enabling TestMode
A lot of the functions available to programmers can only be used if "TestMode" has been enabled on the Neato. Most functions displayed in the Help are listed as "TestMode Only" which will give you an idea as to what can be only be used when TestMode is enabled.
If you attempt to use a command before you have enabled TestMode, Neato will politely state that "
TestMode must be on to use this command."
To Enable TestMode
testmode on
To Disable TestMode (do remember to disable TestMode to return your Neato back to normal after you have finished tinkering)
testmode off
With TestMode enabled, you Neato will behave a little differently than normal.
- All buttons on the robot will NOT respond to input as it normally does
- You may not be able to re-establish connection to your robot if you unplugged and reconnected in a short period of time. If you cant re-establish connection, wait a few mins before attempting again.
The following commands and examples listed below will assume you have TestMode enabled, (unless specified differently)
Issuing Commands to the Motors
When you are first experimenting with command, I recommend you turn Neato up-side-down so the wheels can free spin. Otherwise you may get instances where your robot drives away faster than you expected, crashing into things and generally making a mess of your room as it lacks logic to stop.
The basic command to move is
setmotor LeftWheelDistance RightWheelDistance Speed
As I tested in firmware 2.6, Neato's maximum speed is 300. If you exceed this value, Neato will report back something like "
Invalid Speed Specified(500). Must be between 0 and 300"
Some basic movement examples
To drive forward 10cm:-
setmotor 100 100 100
To spin on the spot (rotate clockwise):-
setmotor 900 -900 100
To do a left-handed U-Turn (rotate anti-clockwise):-
setmotor 0 1000 100
As I have been experimenting, my Neato seems to steer to the left a little as it drives along in a 'straight' line. I've also had differences in distance travelled depending on my speed setting. I have yet to sit down and measure the accuracy of these movement commands.
Problems You May Encounter
A little issue I found in my tinkering exploits, Neato would suddenly power off when issuing commands. This seems to be because I was issuing a large amount of commands within a short period of time. To give you an idea, I was issuing a set of three SetLED commands once every 20ms. Within about 2seconds, Neato would power off. To fix the issue, unplug your USB, power up Neato and reconnect the USB.